package com.openget.lang;

import javax.lang.model.type.NullType;

import org.w3c.dom.Element;

import com.openget.util.IDelegate;

public class HttpElement extends ElementModel implements IFunctionElement<NullType, IDelegate<byte[]>> {
	
	public HttpElement (Element source) {
		super(source);
	}
	
	public HttpElement (Element source, String url) {
		super(source);
		url = null;
	}

	@Override
	public NullType call(OpengetContext context, IDelegate<byte[]> callback) {	
		context.Infrastructure.httpFetchAsync((String)context.getRunning().get("url"), "GET", null, null, callback);
		return null;
	}

}
